# Maintainer: Felix Huettner <huettner94@gmx.de>

pkgname=mutt
pkgver=2.0.4
pkgrel=1
pkgdesc='Small but very powerful text-based mail client (net-utils)'
url='http://www.mutt.org/'
license=('GPL')
groups=('net-utils')
backup=('etc/Muttrc')
arch=('i686' 'x86_64')
depends=('libgpgme' 'libsasl' 'libgdbm' 'ncurses' 'libgnutls' 'libidn2' 'libsqlite' 'zlib')
makedepends=('docbook-xml'
             'docbook-xsl'
             'elinks'
             'libgdbm-devel'
             'libgnutls-devel'
             'libgpgme-devel'
             'libidn2-devel'
             'libsasl-devel'
             'libsqlite-devel'
             'ncurses-devel'
             'zlib-devel')
source=("http://ftp.mutt.org/pub/mutt/${pkgname}-${pkgver}.tar.gz"{,.asc})
sha256sums=('45087e78105e9abc7cc37827865d319081587cb53a94412aa4e3118e937991d4'
            'SKIP')
validpgpkeys=('8975A9B33AA37910385C5308ADEF768480316BDA') # Kevin J. McCarthy <kevin@8t8.us>

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --enable-gpgme \
    --enable-pop \
    --enable-imap \
    --enable-smtp \
    --enable-hcache \
    --with-curses=/usr \
    --with-gss=/usr \
    --with-gnutls=/usr \
    --with-sqlite3=/usr \
    --with-sasl \
    --with-idn2 \
    --with-gdbm \
    --with-mailpath=/var/spool/mail

  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make -k check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install

  rm "${pkgdir}"/etc/mime.types{,.dist}
  install -Dm644 contrib/gpg.rc "${pkgdir}"/etc/Muttrc.gpg.dist
}
